package com.wdnmd.quickceshi.domain;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Map;
/*
    将配置文件中的每一个属性的值，映射到这个组件中
    @ConfigurationProperties : 告诉spring-boot将本类中所有的属性和配置文件中的相关配置进行绑定:
        prefix:"person" (配置文件中 person下的所有属性一一映射) , 从|全局|配置文件中获取值
    需要将对象放到spring容器中(@Component)
 */
@ConfigurationProperties(prefix = "person")
@Component
public class Person {
    private String name;
    private Integer age;
    private String sex;
    private Map<String , Object> map;
    private Integer[] arr;
    private Dog dog;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }

    public Integer[] getArr() {
        return arr;
    }

    public void setArr(Integer[] arr) {
        this.arr = arr;
    }

    public Dog getDog() {
        return dog;
    }

    public void setDog(Dog dog) {
        this.dog = dog;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", map=" + map +
                ", arr=" + Arrays.toString(arr) +
                ", dog=" + dog +
                '}';
    }
}
